
import java.sql.Connection;
import Model.*;
import java.sql.Date;
import java.sql.DriverManager;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
import java.text.DateFormat;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.swing.JOptionPane;

/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

/**
 *
 * @author Bruno
 */
public class Prototipo extends javax.swing.JFrame {

    /**
     * Creates new form Efetuar
     */
    public Prototipo() {
        initComponents();
    }

    /**
     * This method is called from within the constructor to initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is always
     * regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        jTabbedPane1 = new javax.swing.JTabbedPane();
        PanelCadastros = new javax.swing.JTabbedPane();
        PanelCadastroFuncionario = new javax.swing.JPanel();
        jLabel15 = new javax.swing.JLabel();
        jLabel16 = new javax.swing.JLabel();
        jLabel17 = new javax.swing.JLabel();
        jLabel18 = new javax.swing.JLabel();
        jLabel19 = new javax.swing.JLabel();
        jLabel20 = new javax.swing.JLabel();
        jLabel21 = new javax.swing.JLabel();
        TextFieldFuncionarioCPF = new javax.swing.JTextField();
        TextFieldFuncionarioNome = new javax.swing.JTextField();
        TextFieldFuncionarioNasc = new javax.swing.JTextField();
        TextFieldFuncionarioEndereco = new javax.swing.JTextField();
        TextFieldFuncionarioTelefone = new javax.swing.JTextField();
        TextFieldFuncionarioSalario = new javax.swing.JTextField();
        TextFieldFuncionarioEmail = new javax.swing.JTextField();
        ButtonCadastrarFuncionario = new javax.swing.JButton();
        TextFieldFuncionarioCargo = new javax.swing.JTextField();
        jLabelCargo = new javax.swing.JLabel();
        BotaoSE = new javax.swing.JButton();
        PanelCadastroProduto = new javax.swing.JPanel();
        jLabel22 = new javax.swing.JLabel();
        jLabel23 = new javax.swing.JLabel();
        jLabel24 = new javax.swing.JLabel();
        jLabel25 = new javax.swing.JLabel();
        jLabel26 = new javax.swing.JLabel();
        jLabel27 = new javax.swing.JLabel();
        TextFieldProdutoCodigo = new javax.swing.JTextField();
        TextFieldProdutoNome = new javax.swing.JTextField();
        TextFieldProdutoMarca = new javax.swing.JTextField();
        TextFieldProdutoModelo = new javax.swing.JTextField();
        TextFieldProdutoPreco = new javax.swing.JTextField();
        TextFieldProdutoNumSerie = new javax.swing.JTextField();
        ButtonCadastrarProduto = new javax.swing.JButton();
        PanelCadastroCliente = new javax.swing.JPanel();
        jLabel28 = new javax.swing.JLabel();
        jLabel29 = new javax.swing.JLabel();
        jLabel30 = new javax.swing.JLabel();
        jLabel31 = new javax.swing.JLabel();
        jLabel32 = new javax.swing.JLabel();
        jLabel33 = new javax.swing.JLabel();
        jLabel34 = new javax.swing.JLabel();
        TextFieldClienteCPF = new javax.swing.JTextField();
        TextFieldClienteNome = new javax.swing.JTextField();
        TextFieldClienteNasc = new javax.swing.JTextField();
        TextFieldClienteEndereco = new javax.swing.JTextField();
        TextFieldClienteTelefone = new javax.swing.JTextField();
        TextFieldClienteRendaMensal = new javax.swing.JTextField();
        TextFieldClienteEmail = new javax.swing.JTextField();
        ButtonCadastrarCliente = new javax.swing.JButton();
        PanelVenda = new javax.swing.JPanel();
        jLabel1 = new javax.swing.JLabel();
        jLabel2 = new javax.swing.JLabel();
        jLabel4 = new javax.swing.JLabel();
        jLabel6 = new javax.swing.JLabel();
        TextFieldEfetuarVendaIDvenda = new javax.swing.JTextField();
        TextFieldEfetuarVendaDataGarantia = new javax.swing.JTextField();
        ButtonEfetuarVenda = new javax.swing.JButton();
        jScrollPane1 = new javax.swing.JScrollPane();
        ListEfetuarVendaClienteCPF = new javax.swing.JList();
        jScrollPane3 = new javax.swing.JScrollPane();
        ListEfetuarVendaFuncionarioCPF = new javax.swing.JList();
        jLabel9 = new javax.swing.JLabel();
        TextFieldEfetuarVendaCodProduto = new javax.swing.JTextField();
        jButton3 = new javax.swing.JButton();
        ComboBoxEfetuarVendaItensCarrinho = new javax.swing.JComboBox();
        jLabel3 = new javax.swing.JLabel();
        jLabel7 = new javax.swing.JLabel();
        TextFieldEfetuarVendaDataCompra = new javax.swing.JTextField();
        PanelTroca = new javax.swing.JPanel();
        jLabel5 = new javax.swing.JLabel();
        TextFieldCodProdutoDefeituoso = new javax.swing.JTextField();
        jButton1 = new javax.swing.JButton();
        jLabel8 = new javax.swing.JLabel();
        jScrollPane2 = new javax.swing.JScrollPane();
        ListTrocaCodProdutoNovo = new javax.swing.JList();
        jButton2 = new javax.swing.JButton();
        TituloPrograma = new javax.swing.JLabel();

        setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
        setTitle("Sistema de Venda de Eletrodomésticos");
        setBackground(new java.awt.Color(153, 255, 102));
        setBounds(new java.awt.Rectangle(0, 0, 0, 0));

        jLabel15.setText("CPF");

        jLabel16.setText("Nome");

        jLabel17.setText("Data de Nascimento");

        jLabel18.setText("Endereço");

        jLabel19.setText("E-mail");

        jLabel20.setText("Telefone");

        jLabel21.setText("Salário");

        ButtonCadastrarFuncionario.setText("Cadastrar");
        ButtonCadastrarFuncionario.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                ButtonCadastrarFuncionarioActionPerformed(evt);
            }
        });

        jLabelCargo.setText("Função");

        BotaoSE.setText("se");
        BotaoSE.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                BotaoSEActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout PanelCadastroFuncionarioLayout = new javax.swing.GroupLayout(PanelCadastroFuncionario);
        PanelCadastroFuncionario.setLayout(PanelCadastroFuncionarioLayout);
        PanelCadastroFuncionarioLayout.setHorizontalGroup(
            PanelCadastroFuncionarioLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(PanelCadastroFuncionarioLayout.createSequentialGroup()
                .addGap(108, 108, 108)
                .addComponent(ButtonCadastrarFuncionario, javax.swing.GroupLayout.PREFERRED_SIZE, 122, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(26, 26, 26)
                .addComponent(BotaoSE)
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, PanelCadastroFuncionarioLayout.createSequentialGroup()
                .addContainerGap()
                .addGroup(PanelCadastroFuncionarioLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                    .addGroup(PanelCadastroFuncionarioLayout.createSequentialGroup()
                        .addComponent(jLabelCargo)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                        .addComponent(TextFieldFuncionarioCargo, javax.swing.GroupLayout.PREFERRED_SIZE, 120, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addGroup(javax.swing.GroupLayout.Alignment.LEADING, PanelCadastroFuncionarioLayout.createSequentialGroup()
                        .addComponent(jLabel21)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                        .addComponent(TextFieldFuncionarioSalario, javax.swing.GroupLayout.PREFERRED_SIZE, 120, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addGroup(PanelCadastroFuncionarioLayout.createSequentialGroup()
                        .addComponent(jLabel20)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                        .addComponent(TextFieldFuncionarioTelefone, javax.swing.GroupLayout.PREFERRED_SIZE, 120, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addGroup(PanelCadastroFuncionarioLayout.createSequentialGroup()
                        .addComponent(jLabel19)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                        .addComponent(TextFieldFuncionarioEmail, javax.swing.GroupLayout.PREFERRED_SIZE, 120, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addGroup(PanelCadastroFuncionarioLayout.createSequentialGroup()
                        .addComponent(jLabel18)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                        .addComponent(TextFieldFuncionarioEndereco, javax.swing.GroupLayout.PREFERRED_SIZE, 120, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addGroup(PanelCadastroFuncionarioLayout.createSequentialGroup()
                        .addComponent(jLabel17)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 63, Short.MAX_VALUE)
                        .addComponent(TextFieldFuncionarioNasc, javax.swing.GroupLayout.PREFERRED_SIZE, 120, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addGroup(PanelCadastroFuncionarioLayout.createSequentialGroup()
                        .addComponent(jLabel16)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                        .addComponent(TextFieldFuncionarioNome, javax.swing.GroupLayout.PREFERRED_SIZE, 120, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addGroup(PanelCadastroFuncionarioLayout.createSequentialGroup()
                        .addComponent(jLabel15)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                        .addComponent(TextFieldFuncionarioCPF, javax.swing.GroupLayout.PREFERRED_SIZE, 120, javax.swing.GroupLayout.PREFERRED_SIZE)))
                .addGap(46, 46, 46))
        );
        PanelCadastroFuncionarioLayout.setVerticalGroup(
            PanelCadastroFuncionarioLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(PanelCadastroFuncionarioLayout.createSequentialGroup()
                .addGap(14, 14, 14)
                .addGroup(PanelCadastroFuncionarioLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel15)
                    .addComponent(TextFieldFuncionarioCPF, javax.swing.GroupLayout.PREFERRED_SIZE, 20, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(18, 18, 18)
                .addGroup(PanelCadastroFuncionarioLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel16)
                    .addComponent(TextFieldFuncionarioNome, javax.swing.GroupLayout.PREFERRED_SIZE, 20, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(18, 18, 18)
                .addGroup(PanelCadastroFuncionarioLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel17)
                    .addComponent(TextFieldFuncionarioNasc, javax.swing.GroupLayout.PREFERRED_SIZE, 20, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(18, 18, 18)
                .addGroup(PanelCadastroFuncionarioLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel18)
                    .addComponent(TextFieldFuncionarioEndereco, javax.swing.GroupLayout.PREFERRED_SIZE, 20, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(18, 18, 18)
                .addGroup(PanelCadastroFuncionarioLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jLabel19)
                    .addComponent(TextFieldFuncionarioEmail, javax.swing.GroupLayout.PREFERRED_SIZE, 20, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(18, 18, 18)
                .addGroup(PanelCadastroFuncionarioLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel20)
                    .addComponent(TextFieldFuncionarioTelefone, javax.swing.GroupLayout.PREFERRED_SIZE, 20, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(18, 18, 18)
                .addGroup(PanelCadastroFuncionarioLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel21)
                    .addComponent(TextFieldFuncionarioSalario, javax.swing.GroupLayout.PREFERRED_SIZE, 20, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(PanelCadastroFuncionarioLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(TextFieldFuncionarioCargo, javax.swing.GroupLayout.PREFERRED_SIZE, 20, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabelCargo))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(PanelCadastroFuncionarioLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(ButtonCadastrarFuncionario, javax.swing.GroupLayout.PREFERRED_SIZE, 34, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(BotaoSE))
                .addGap(0, 31, Short.MAX_VALUE))
        );

        PanelCadastros.addTab("Cadastrar Funcionario", PanelCadastroFuncionario);

        jLabel22.setText("Código");

        jLabel23.setText("Nome");

        jLabel24.setText("Marca");

        jLabel25.setText("Modelo");

        jLabel26.setText("Preço");

        jLabel27.setText("Numero de Série");

        TextFieldProdutoNome.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                TextFieldProdutoNomeActionPerformed(evt);
            }
        });

        ButtonCadastrarProduto.setText("Cadastrar");
        ButtonCadastrarProduto.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                ButtonCadastrarProdutoActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout PanelCadastroProdutoLayout = new javax.swing.GroupLayout(PanelCadastroProduto);
        PanelCadastroProduto.setLayout(PanelCadastroProdutoLayout);
        PanelCadastroProdutoLayout.setHorizontalGroup(
            PanelCadastroProdutoLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(PanelCadastroProdutoLayout.createSequentialGroup()
                .addContainerGap()
                .addGroup(PanelCadastroProdutoLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(PanelCadastroProdutoLayout.createSequentialGroup()
                        .addComponent(jLabel27)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 82, Short.MAX_VALUE)
                        .addComponent(TextFieldProdutoNumSerie, javax.swing.GroupLayout.PREFERRED_SIZE, 124, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, PanelCadastroProdutoLayout.createSequentialGroup()
                        .addComponent(jLabel26)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                        .addComponent(TextFieldProdutoPreco, javax.swing.GroupLayout.PREFERRED_SIZE, 124, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, PanelCadastroProdutoLayout.createSequentialGroup()
                        .addComponent(jLabel25)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                        .addComponent(TextFieldProdutoModelo, javax.swing.GroupLayout.PREFERRED_SIZE, 124, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, PanelCadastroProdutoLayout.createSequentialGroup()
                        .addComponent(jLabel24)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                        .addComponent(TextFieldProdutoMarca, javax.swing.GroupLayout.PREFERRED_SIZE, 124, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, PanelCadastroProdutoLayout.createSequentialGroup()
                        .addComponent(jLabel23)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                        .addComponent(TextFieldProdutoNome, javax.swing.GroupLayout.PREFERRED_SIZE, 124, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, PanelCadastroProdutoLayout.createSequentialGroup()
                        .addComponent(jLabel22)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                        .addComponent(TextFieldProdutoCodigo, javax.swing.GroupLayout.PREFERRED_SIZE, 124, javax.swing.GroupLayout.PREFERRED_SIZE)))
                .addGap(40, 40, 40))
            .addGroup(PanelCadastroProdutoLayout.createSequentialGroup()
                .addGap(114, 114, 114)
                .addComponent(ButtonCadastrarProduto, javax.swing.GroupLayout.PREFERRED_SIZE, 122, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );
        PanelCadastroProdutoLayout.setVerticalGroup(
            PanelCadastroProdutoLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(PanelCadastroProdutoLayout.createSequentialGroup()
                .addGap(28, 28, 28)
                .addGroup(PanelCadastroProdutoLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel22)
                    .addComponent(TextFieldProdutoCodigo, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(21, 21, 21)
                .addGroup(PanelCadastroProdutoLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel23)
                    .addComponent(TextFieldProdutoNome, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(18, 18, 18)
                .addGroup(PanelCadastroProdutoLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel24)
                    .addComponent(TextFieldProdutoMarca, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(18, 18, 18)
                .addGroup(PanelCadastroProdutoLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel25)
                    .addComponent(TextFieldProdutoModelo, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(18, 18, 18)
                .addGroup(PanelCadastroProdutoLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel26)
                    .addComponent(TextFieldProdutoPreco, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(18, 18, 18)
                .addGroup(PanelCadastroProdutoLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel27)
                    .addComponent(TextFieldProdutoNumSerie, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 84, Short.MAX_VALUE)
                .addComponent(ButtonCadastrarProduto, javax.swing.GroupLayout.PREFERRED_SIZE, 33, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap())
        );

        PanelCadastros.addTab("Cadastrar Produto", PanelCadastroProduto);

        jLabel28.setText("CPF");

        jLabel29.setText("Nome");

        jLabel30.setText("Data de Nascimento");

        jLabel31.setText("Endereço");

        jLabel32.setText("E-mail");

        jLabel33.setText("Telefone");

        jLabel34.setText("Renda Mensal");

        ButtonCadastrarCliente.setText("Cadastrar");

        javax.swing.GroupLayout PanelCadastroClienteLayout = new javax.swing.GroupLayout(PanelCadastroCliente);
        PanelCadastroCliente.setLayout(PanelCadastroClienteLayout);
        PanelCadastroClienteLayout.setHorizontalGroup(
            PanelCadastroClienteLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(PanelCadastroClienteLayout.createSequentialGroup()
                .addGap(22, 22, 22)
                .addGroup(PanelCadastroClienteLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(PanelCadastroClienteLayout.createSequentialGroup()
                        .addComponent(jLabel34)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                        .addComponent(TextFieldClienteRendaMensal, javax.swing.GroupLayout.PREFERRED_SIZE, 120, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, PanelCadastroClienteLayout.createSequentialGroup()
                        .addComponent(jLabel33)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                        .addComponent(TextFieldClienteTelefone, javax.swing.GroupLayout.PREFERRED_SIZE, 120, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, PanelCadastroClienteLayout.createSequentialGroup()
                        .addComponent(jLabel32)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                        .addComponent(TextFieldClienteEmail, javax.swing.GroupLayout.PREFERRED_SIZE, 120, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, PanelCadastroClienteLayout.createSequentialGroup()
                        .addComponent(jLabel31)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                        .addComponent(TextFieldClienteEndereco, javax.swing.GroupLayout.PREFERRED_SIZE, 120, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, PanelCadastroClienteLayout.createSequentialGroup()
                        .addComponent(jLabel30)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 63, Short.MAX_VALUE)
                        .addComponent(TextFieldClienteNasc, javax.swing.GroupLayout.PREFERRED_SIZE, 120, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, PanelCadastroClienteLayout.createSequentialGroup()
                        .addComponent(jLabel29)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                        .addComponent(TextFieldClienteNome, javax.swing.GroupLayout.PREFERRED_SIZE, 120, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, PanelCadastroClienteLayout.createSequentialGroup()
                        .addComponent(jLabel28)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                        .addComponent(TextFieldClienteCPF, javax.swing.GroupLayout.PREFERRED_SIZE, 120, javax.swing.GroupLayout.PREFERRED_SIZE)))
                .addGap(34, 34, 34))
            .addGroup(PanelCadastroClienteLayout.createSequentialGroup()
                .addGap(105, 105, 105)
                .addComponent(ButtonCadastrarCliente, javax.swing.GroupLayout.PREFERRED_SIZE, 122, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );
        PanelCadastroClienteLayout.setVerticalGroup(
            PanelCadastroClienteLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(PanelCadastroClienteLayout.createSequentialGroup()
                .addGap(19, 19, 19)
                .addGroup(PanelCadastroClienteLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                    .addComponent(jLabel28)
                    .addComponent(TextFieldClienteCPF, javax.swing.GroupLayout.PREFERRED_SIZE, 20, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(18, 18, 18)
                .addGroup(PanelCadastroClienteLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel29)
                    .addComponent(TextFieldClienteNome, javax.swing.GroupLayout.PREFERRED_SIZE, 20, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(18, 18, 18)
                .addGroup(PanelCadastroClienteLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel30)
                    .addComponent(TextFieldClienteNasc, javax.swing.GroupLayout.PREFERRED_SIZE, 20, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(18, 18, 18)
                .addGroup(PanelCadastroClienteLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel31)
                    .addComponent(TextFieldClienteEndereco, javax.swing.GroupLayout.PREFERRED_SIZE, 20, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(18, 18, 18)
                .addGroup(PanelCadastroClienteLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jLabel32)
                    .addComponent(TextFieldClienteEmail, javax.swing.GroupLayout.PREFERRED_SIZE, 20, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(18, 18, 18)
                .addGroup(PanelCadastroClienteLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel33)
                    .addComponent(TextFieldClienteTelefone, javax.swing.GroupLayout.PREFERRED_SIZE, 20, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(18, 18, 18)
                .addGroup(PanelCadastroClienteLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel34)
                    .addComponent(TextFieldClienteRendaMensal, javax.swing.GroupLayout.PREFERRED_SIZE, 20, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(ButtonCadastrarCliente, javax.swing.GroupLayout.PREFERRED_SIZE, 34, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(62, Short.MAX_VALUE))
        );

        PanelCadastros.addTab("Cadastrar Cliente", PanelCadastroCliente);

        jTabbedPane1.addTab("Efetuar Cadastros", PanelCadastros);

        jLabel1.setText("ID Venda");

        jLabel2.setText("Cliente CPF");

        jLabel4.setText("Funcionario CPF");

        jLabel6.setText("Data de Garantia");

        TextFieldEfetuarVendaIDvenda.setEditable(false);
        TextFieldEfetuarVendaIDvenda.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                TextFieldEfetuarVendaIDvendaActionPerformed(evt);
            }
        });

        TextFieldEfetuarVendaDataGarantia.setEditable(false);

        ButtonEfetuarVenda.setText("Finalizar");
        ButtonEfetuarVenda.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                ButtonEfetuarVendaActionPerformed(evt);
            }
        });

        ListEfetuarVendaClienteCPF.setModel(new javax.swing.AbstractListModel() {
            //String[] strings = { "Item 1", "Item 2", "Item 3", "Item 4", "Item 5" };
            int[] values = { };
            public int getSize() { return values.length; }
            public Object getElementAt(int i) { return values[i]; }
        });
        ListEfetuarVendaClienteCPF.setSelectionMode(javax.swing.ListSelectionModel.SINGLE_SELECTION);
        jScrollPane1.setViewportView(ListEfetuarVendaClienteCPF);

        ListEfetuarVendaFuncionarioCPF.setModel(new javax.swing.AbstractListModel() {
            //String[] strings = { "Item 1", "Item 2", "Item 3", "Item 4", "Item 5" };
            String[] strings = { };
            public int getSize() { return strings.length; }
            public Object getElementAt(int i) { return strings[i]; }
        });
        jScrollPane3.setViewportView(ListEfetuarVendaFuncionarioCPF);

        jLabel9.setText("Código do Produto");

        TextFieldEfetuarVendaCodProduto.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                TextFieldEfetuarVendaCodProdutoActionPerformed(evt);
            }
        });

        jButton3.setText("Acrescentar ao Carrinho");

        ComboBoxEfetuarVendaItensCarrinho.setModel(new javax.swing.DefaultComboBoxModel(
            //new String[] { "Item 1", "Item 2", "Item 3", "Item 4" }
            new String[] { }
        ));

        jLabel3.setText("Itens no carrinho");

        jLabel7.setText("Data de Venda");

        javax.swing.GroupLayout PanelVendaLayout = new javax.swing.GroupLayout(PanelVenda);
        PanelVenda.setLayout(PanelVendaLayout);
        PanelVendaLayout.setHorizontalGroup(
            PanelVendaLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(PanelVendaLayout.createSequentialGroup()
                .addGroup(PanelVendaLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(PanelVendaLayout.createSequentialGroup()
                        .addGroup(PanelVendaLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addGroup(PanelVendaLayout.createSequentialGroup()
                                .addGap(113, 113, 113)
                                .addComponent(ButtonEfetuarVenda, javax.swing.GroupLayout.PREFERRED_SIZE, 98, javax.swing.GroupLayout.PREFERRED_SIZE))
                            .addGroup(PanelVendaLayout.createSequentialGroup()
                                .addContainerGap()
                                .addComponent(jLabel7)))
                        .addGap(0, 0, Short.MAX_VALUE))
                    .addGroup(PanelVendaLayout.createSequentialGroup()
                        .addContainerGap()
                        .addGroup(PanelVendaLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addGroup(PanelVendaLayout.createSequentialGroup()
                                .addGroup(PanelVendaLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                    .addComponent(jLabel1)
                                    .addComponent(jLabel9))
                                .addGap(78, 78, 78)
                                .addGroup(PanelVendaLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                    .addComponent(TextFieldEfetuarVendaIDvenda)
                                    .addComponent(TextFieldEfetuarVendaCodProduto)))
                            .addGroup(PanelVendaLayout.createSequentialGroup()
                                .addComponent(jLabel2)
                                .addGap(112, 112, 112)
                                .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 0, Short.MAX_VALUE))
                            .addGroup(PanelVendaLayout.createSequentialGroup()
                                .addGroup(PanelVendaLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                    .addComponent(jLabel6)
                                    .addComponent(jLabel4))
                                .addGap(85, 85, 85)
                                .addGroup(PanelVendaLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                    .addComponent(jScrollPane3, javax.swing.GroupLayout.PREFERRED_SIZE, 0, Short.MAX_VALUE)
                                    .addComponent(TextFieldEfetuarVendaDataGarantia)
                                    .addComponent(TextFieldEfetuarVendaDataCompra)))
                            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, PanelVendaLayout.createSequentialGroup()
                                .addComponent(jLabel3)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 79, Short.MAX_VALUE)
                                .addGroup(PanelVendaLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                                    .addComponent(jButton3, javax.swing.GroupLayout.DEFAULT_SIZE, 159, Short.MAX_VALUE)
                                    .addComponent(ComboBoxEfetuarVendaItensCarrinho, 0, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))))))
                .addContainerGap())
        );
        PanelVendaLayout.setVerticalGroup(
            PanelVendaLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(PanelVendaLayout.createSequentialGroup()
                .addContainerGap()
                .addGroup(PanelVendaLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel1)
                    .addComponent(TextFieldEfetuarVendaIDvenda, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(18, 18, 18)
                .addGroup(PanelVendaLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel9)
                    .addComponent(TextFieldEfetuarVendaCodProduto, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 63, Short.MAX_VALUE)
                .addComponent(jButton3, javax.swing.GroupLayout.PREFERRED_SIZE, 33, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(18, 18, 18)
                .addGroup(PanelVendaLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(ComboBoxEfetuarVendaItensCarrinho, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel3))
                .addGroup(PanelVendaLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(PanelVendaLayout.createSequentialGroup()
                        .addGap(24, 24, 24)
                        .addComponent(jLabel2))
                    .addGroup(PanelVendaLayout.createSequentialGroup()
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 33, javax.swing.GroupLayout.PREFERRED_SIZE)))
                .addGroup(PanelVendaLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(PanelVendaLayout.createSequentialGroup()
                        .addGap(20, 20, 20)
                        .addComponent(jLabel4))
                    .addGroup(PanelVendaLayout.createSequentialGroup()
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addComponent(jScrollPane3, javax.swing.GroupLayout.PREFERRED_SIZE, 33, javax.swing.GroupLayout.PREFERRED_SIZE)))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(PanelVendaLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, PanelVendaLayout.createSequentialGroup()
                        .addGap(3, 3, 3)
                        .addComponent(jLabel7))
                    .addComponent(TextFieldEfetuarVendaDataCompra, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(PanelVendaLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(PanelVendaLayout.createSequentialGroup()
                        .addGap(9, 9, 9)
                        .addComponent(jLabel6))
                    .addGroup(PanelVendaLayout.createSequentialGroup()
                        .addComponent(TextFieldEfetuarVendaDataGarantia, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(ButtonEfetuarVenda, javax.swing.GroupLayout.PREFERRED_SIZE, 37, javax.swing.GroupLayout.PREFERRED_SIZE)))
                .addContainerGap())
        );

        jTabbedPane1.addTab("Efetuar Venda", PanelVenda);

        jLabel5.setText("Código do Produto Defeituoso");

        TextFieldCodProdutoDefeituoso.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                TextFieldCodProdutoDefeituosoActionPerformed(evt);
            }
        });

        jButton1.setText("Analisar Situação");

        jLabel8.setText("Código do Novo Produto");

        ListTrocaCodProdutoNovo.setModel(new javax.swing.AbstractListModel() {
            //String[] strings = { "Item 1", "Item 2", "Item 3", "Item 4", "Item 5" };
            String[] strings = { };
            public int getSize() { return strings.length; }
            public Object getElementAt(int i) { return strings[i]; }
        });
        ListTrocaCodProdutoNovo.setSelectionMode(javax.swing.ListSelectionModel.SINGLE_SELECTION);
        ListTrocaCodProdutoNovo.setToolTipText("");
        jScrollPane2.setViewportView(ListTrocaCodProdutoNovo);

        jButton2.setText("Finalizar Troca");

        javax.swing.GroupLayout PanelTrocaLayout = new javax.swing.GroupLayout(PanelTroca);
        PanelTroca.setLayout(PanelTrocaLayout);
        PanelTrocaLayout.setHorizontalGroup(
            PanelTrocaLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(PanelTrocaLayout.createSequentialGroup()
                .addGroup(PanelTrocaLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(PanelTrocaLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                        .addGroup(PanelTrocaLayout.createSequentialGroup()
                            .addContainerGap()
                            .addComponent(jLabel8)
                            .addGap(45, 45, 45)
                            .addComponent(jScrollPane2, javax.swing.GroupLayout.PREFERRED_SIZE, 144, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addGroup(PanelTrocaLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addGroup(PanelTrocaLayout.createSequentialGroup()
                                .addContainerGap()
                                .addComponent(jLabel5)
                                .addGap(18, 18, 18)
                                .addComponent(TextFieldCodProdutoDefeituoso, javax.swing.GroupLayout.PREFERRED_SIZE, 144, javax.swing.GroupLayout.PREFERRED_SIZE))
                            .addGroup(PanelTrocaLayout.createSequentialGroup()
                                .addGap(97, 97, 97)
                                .addComponent(jButton1, javax.swing.GroupLayout.PREFERRED_SIZE, 133, javax.swing.GroupLayout.PREFERRED_SIZE))))
                    .addGroup(PanelTrocaLayout.createSequentialGroup()
                        .addGap(104, 104, 104)
                        .addComponent(jButton2, javax.swing.GroupLayout.PREFERRED_SIZE, 113, javax.swing.GroupLayout.PREFERRED_SIZE)))
                .addContainerGap(24, Short.MAX_VALUE))
        );
        PanelTrocaLayout.setVerticalGroup(
            PanelTrocaLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(PanelTrocaLayout.createSequentialGroup()
                .addGap(39, 39, 39)
                .addGroup(PanelTrocaLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel5)
                    .addComponent(TextFieldCodProdutoDefeituoso, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(31, 31, 31)
                .addComponent(jButton1, javax.swing.GroupLayout.PREFERRED_SIZE, 50, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGroup(PanelTrocaLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(PanelTrocaLayout.createSequentialGroup()
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 115, Short.MAX_VALUE)
                        .addComponent(jLabel8)
                        .addGap(29, 29, 29))
                    .addGroup(PanelTrocaLayout.createSequentialGroup()
                        .addGap(51, 51, 51)
                        .addComponent(jScrollPane2, javax.swing.GroupLayout.PREFERRED_SIZE, 34, javax.swing.GroupLayout.PREFERRED_SIZE)))
                .addComponent(jButton2, javax.swing.GroupLayout.PREFERRED_SIZE, 54, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(45, 45, 45))
        );

        jTabbedPane1.addTab("Efetuar Troca", PanelTroca);

        TituloPrograma.setFont(new java.awt.Font("Tahoma", 1, 14)); // NOI18N
        TituloPrograma.setText("Trabalho de PCS-SGBD (Eletrodomésticos)");

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addGap(20, 20, 20)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jTabbedPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 345, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(TituloPrograma, javax.swing.GroupLayout.PREFERRED_SIZE, 307, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
                .addComponent(TituloPrograma, javax.swing.GroupLayout.PREFERRED_SIZE, 35, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jTabbedPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 425, Short.MAX_VALUE)
                .addContainerGap())
        );

        pack();
    }// </editor-fold>//GEN-END:initComponents

    private void TextFieldEfetuarVendaIDvendaActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_TextFieldEfetuarVendaIDvendaActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_TextFieldEfetuarVendaIDvendaActionPerformed

    private void ButtonEfetuarVendaActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_ButtonEfetuarVendaActionPerformed
        //realizar o carregamento do JDBC 

        try{
            Class.forName("org.postgresql.Driver");
            //Construindo a conexao com SGBD PostgreSQL
//            Connection conexao = DriverManager.getConnection("jdbc:postgresql://localhost:5432/postgres", "postgres", "12345");
//            JOptionPane.showMessageDialog (null, "CONEXÃO REALIZADA!");
            Connection con;
            con = DriverManager.getConnection("jdbc:postgresql://localhost:5432/postgres", "postgres", "1q2w3e");
            JOptionPane.showMessageDialog (null, "CONEXÃO REALIZADA!");
            String query = "INSERT INTO compra VALUES(?,?,?,?,?,?,?)"; 
            PreparedStatement stmt = con.prepareStatement(query); 
            
            
            stmt.setInt(1, Integer.parseInt(TextFieldEfetuarVendaIDvenda.getText())); 
            stmt.setInt(2, (int)ListEfetuarVendaClienteCPF.getSelectedValue());

            stmt.setDate(3, java.sql.Date.valueOf(new Vendas().formataDataRetornaBD(TextFieldEfetuarVendaDataCompra.getText())));  
            stmt.setString(4, ""); //gerente do funcionario
            stmt.setString(5, ""); //numero Nota Fiscal
            stmt.setDate(6, java.sql.Date.valueOf(new Vendas().formataDataRetornaBD(TextFieldEfetuarVendaDataGarantia.getText()))); 
            
            stmt.setString(7, "");//cpf_cliente denovo?
            
            stmt.executeUpdate(); 
            
            stmt.close(); 
            con.close(); 
            JOptionPane.showMessageDialog (null, "REGISTRO GRAVADO!");
            
            /*Statement instrucao = conexao.createStatement();
            instrucao.executeUpdate("insert into compra values(4444,5555,'03/08/13',3333,76578,'03/08/16',5555)");*/        
            //construcao da classe  PreparedStatement para passagem de parametros
            
//            PreparedStatement instrucao = conexao.prepareStatement("INSERT INTO compra VALUES(?,?,?,?,?,?,?,?,?)");
//            instrucao.setInt(1,Integer.parseInt(jTextField1.getText()));
//            instrucao.setInt(2,Integer.parseInt(jTextField2.getText()));
//            instrucao.setString(3,jTextField3.getText());
//            instrucao.setInt(4,Integer.parseInt(jTextField4.getText()));
//            instrucao.setInt(5,Integer.parseInt(jTextField5.getText()));
//            instrucao.setString(6,jTextField6.getText());
//            instrucao.setInt(7,Integer.parseInt(jTextField7.getText()));
//            
//            JOptionPane.showMessageDialog (null, "REGISTRO GRAVADO!");
        }catch(ClassNotFoundException e){
            JOptionPane.showMessageDialog(null, "ERRO CLASSE: " + e.getMessage());
        }catch(SQLException e){
            JOptionPane.showMessageDialog(null, "ERRO SQL: " + e.getMessage());
        } catch (ParseException ex) {
            Logger.getLogger(Prototipo.class.getName()).log(Level.SEVERE, null, ex);
        }
    }//GEN-LAST:event_ButtonEfetuarVendaActionPerformed

    private void ButtonCadastrarProdutoActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_ButtonCadastrarProdutoActionPerformed

        

        
        
        // TODO add your handling code here:
    }//GEN-LAST:event_ButtonCadastrarProdutoActionPerformed

    private void TextFieldProdutoNomeActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_TextFieldProdutoNomeActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_TextFieldProdutoNomeActionPerformed

    private void TextFieldCodProdutoDefeituosoActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_TextFieldCodProdutoDefeituosoActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_TextFieldCodProdutoDefeituosoActionPerformed

    private void TextFieldEfetuarVendaCodProdutoActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_TextFieldEfetuarVendaCodProdutoActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_TextFieldEfetuarVendaCodProdutoActionPerformed

    private void BotaoSEActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_BotaoSEActionPerformed

          Connection conn = null;
        

        try {
            Class.forName("org.postgresql.Driver");
            String sql = "select * from compra";
            conn = DriverManager.getConnection("jdbc:postgresql://localhost:5432/postgres", "postgres", "1q2w3e");
            Statement st = conn.createStatement();
            ResultSet rs = st.executeQuery(sql);
            String[] arr = null;
            while (rs.next()) {
                String em = rs.getString("idcompra");
               arr = em.split("\n");
               for (int i =0; i < arr.length; i++){
                  this.TextFieldClienteEmail.setText(arr[i]);
                  
               }
            }
        } catch (Exception asd) {
            System.out.println(asd);
        }
                
            
        // TODO add your handling code here:
    }//GEN-LAST:event_BotaoSEActionPerformed

    private void ButtonCadastrarFuncionarioActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_ButtonCadastrarFuncionarioActionPerformed

        try{
            Class.forName("org.postgresql.Driver");
            //Construindo a conexao com SGBD PostgreSQL
//            Connection conexao = DriverManager.getConnection("jdbc:postgresql://localhost:5432/postgres", "postgres", "12345");
//            JOptionPane.showMessageDialog (null, "CONEXÃO REALIZADA!");
            Connection con;
            con = DriverManager.getConnection("jdbc:postgresql://localhost:5432/postgres", "postgres", "1q2w3e");
            
            
            String campoEnd = this.TextFieldFuncionarioEndereco.getText();
            Endereco ender = new Endereco();
            ender.SetEnderecoCompleto(campoEnd);
               
            
        
        if (this.TextFieldFuncionarioCargo.getText().equalsIgnoreCase("gerente")){
            int CPF_gerente = Integer.parseInt(this.TextFieldFuncionarioCPF.getText());
                  String inicioGerencia = "01/01/2013"; 
                  int CPF = Integer.parseInt(this.TextFieldFuncionarioCPF.getText());
                  String nome = this.TextFieldFuncionarioNome.getText(); 
                  String dataNascimento = this.TextFieldFuncionarioNasc.getText(); 
                  Endereco enderec = ender; 
                  double salario = Double.valueOf(this.TextFieldFuncionarioSalario.getText());
                  String email = this.TextFieldFuncionarioEmail.getText();
                  String telefone = this.TextFieldFuncionarioTelefone.getText();
             Gerente manager = new Gerente (CPF, inicioGerencia, CPF,  nome, dataNascimento, enderec, salario, email, telefone);
            
        }else{
            int CPF_gerente = Integer.parseInt(this.TextFieldFuncionarioCPF.getText());
                  String inicioGerencia = "01/01/2013"; 
                  int CPF = Integer.parseInt(this.TextFieldFuncionarioCPF.getText());
                  String nome = this.TextFieldFuncionarioNome.getText(); 
                  String dataNascimento = this.TextFieldFuncionarioNasc.getText(); 
                  Endereco enderec = ender; 
                  double salario = Double.valueOf(this.TextFieldFuncionarioSalario.getText());
                  String email = this.TextFieldFuncionarioEmail.getText();
                  String telefone = this.TextFieldFuncionarioTelefone.getText();
            Vendedor vend = new Vendedor(CPF_gerente, "01/01/2013" , CPF, nome, dataNascimento, ender, salario, email, telefone);
            
        }
        
        //JOptionPane.showMessageDialog (null, "CONEXÃO REALIZADA!");
            String query = "INSERT INTO Funcionario VALUES(,?,?,?,?,?,?)"; 
            stmt.setInt(1, Integer.parseInt(jTextField1.getText())); 
            stmt.setInt(2, Integer.parseInt(jTextField2.getText()));

            stmt.setDate(3, java.sql.Date.valueOf(new Vendas().formataDataRetornaBD(jTextField3.getText())));  
            stmt.setInt(4, Integer.parseInt(jTextField4.getText())); 
            stmt.setInt(5, Integer.parseInt(jTextField5.getText())); 
            stmt.setDate(6, java.sql.Date.valueOf(new Vendas().formataDataRetornaBD(jTextField6.getText()))); 
            
            stmt.setInt(7, Integer.parseInt(jTextField7.getText()));
            
            stmt.executeUpdate(); 
            
            stmt.close(); 
            con.close(); 
            JOptionPane.showMessageDialog (null, "REGISTRO GRAVADO!");
            
            PreparedStatement stmt = con.prepareStatement(query);
        
        
        
        
        
        }catch(ClassNotFoundException e){
            JOptionPane.showMessageDialog(null, "ERRO CLASSE: " + e.getMessage());
        }catch(SQLException e){
            JOptionPane.showMessageDialog(null, "ERRO SQL: " + e.getMessage());
        } 
        
        
        
        // TODO add your handling code here:
    }//GEN-LAST:event_ButtonCadastrarFuncionarioActionPerformed

    /**
     * @param args the command line arguments
     */
    public static void main(String args[]) {
        /* Set the Nimbus look and feel */
        //<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
        /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
         * For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html 
         */
        try {
            for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
                if ("Nimbus".equals(info.getName())) {
                    javax.swing.UIManager.setLookAndFeel(info.getClassName());
                    break;
                }
            }
        } catch (ClassNotFoundException ex) {
            java.util.logging.Logger.getLogger(Prototipo.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (InstantiationException ex) {
            java.util.logging.Logger.getLogger(Prototipo.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (IllegalAccessException ex) {
            java.util.logging.Logger.getLogger(Prototipo.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (javax.swing.UnsupportedLookAndFeelException ex) {
            java.util.logging.Logger.getLogger(Prototipo.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        }
        //</editor-fold>

        /* Create and display the form */
        java.awt.EventQueue.invokeLater(new Runnable() {
            public void run() {
                new Prototipo().setVisible(true);
            }
        });
    }

    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JButton BotaoSE;
    private javax.swing.JButton ButtonCadastrarCliente;
    private javax.swing.JButton ButtonCadastrarFuncionario;
    private javax.swing.JButton ButtonCadastrarProduto;
    private javax.swing.JButton ButtonEfetuarVenda;
    private javax.swing.JComboBox ComboBoxEfetuarVendaItensCarrinho;
    private javax.swing.JList ListEfetuarVendaClienteCPF;
    private javax.swing.JList ListEfetuarVendaFuncionarioCPF;
    private javax.swing.JList ListTrocaCodProdutoNovo;
    private javax.swing.JPanel PanelCadastroCliente;
    private javax.swing.JPanel PanelCadastroFuncionario;
    private javax.swing.JPanel PanelCadastroProduto;
    private javax.swing.JTabbedPane PanelCadastros;
    private javax.swing.JPanel PanelTroca;
    private javax.swing.JPanel PanelVenda;
    private javax.swing.JTextField TextFieldClienteCPF;
    private javax.swing.JTextField TextFieldClienteEmail;
    private javax.swing.JTextField TextFieldClienteEndereco;
    private javax.swing.JTextField TextFieldClienteNasc;
    private javax.swing.JTextField TextFieldClienteNome;
    private javax.swing.JTextField TextFieldClienteRendaMensal;
    private javax.swing.JTextField TextFieldClienteTelefone;
    private javax.swing.JTextField TextFieldCodProdutoDefeituoso;
    private javax.swing.JTextField TextFieldEfetuarVendaCodProduto;
    private javax.swing.JTextField TextFieldEfetuarVendaDataCompra;
    private javax.swing.JTextField TextFieldEfetuarVendaDataGarantia;
    private javax.swing.JTextField TextFieldEfetuarVendaIDvenda;
    private javax.swing.JTextField TextFieldFuncionarioCPF;
    private javax.swing.JTextField TextFieldFuncionarioCargo;
    private javax.swing.JTextField TextFieldFuncionarioEmail;
    private javax.swing.JTextField TextFieldFuncionarioEndereco;
    private javax.swing.JTextField TextFieldFuncionarioNasc;
    private javax.swing.JTextField TextFieldFuncionarioNome;
    private javax.swing.JTextField TextFieldFuncionarioSalario;
    private javax.swing.JTextField TextFieldFuncionarioTelefone;
    private javax.swing.JTextField TextFieldProdutoCodigo;
    private javax.swing.JTextField TextFieldProdutoMarca;
    private javax.swing.JTextField TextFieldProdutoModelo;
    private javax.swing.JTextField TextFieldProdutoNome;
    private javax.swing.JTextField TextFieldProdutoNumSerie;
    private javax.swing.JTextField TextFieldProdutoPreco;
    private javax.swing.JLabel TituloPrograma;
    private javax.swing.JButton jButton1;
    private javax.swing.JButton jButton2;
    private javax.swing.JButton jButton3;
    private javax.swing.JLabel jLabel1;
    private javax.swing.JLabel jLabel15;
    private javax.swing.JLabel jLabel16;
    private javax.swing.JLabel jLabel17;
    private javax.swing.JLabel jLabel18;
    private javax.swing.JLabel jLabel19;
    private javax.swing.JLabel jLabel2;
    private javax.swing.JLabel jLabel20;
    private javax.swing.JLabel jLabel21;
    private javax.swing.JLabel jLabel22;
    private javax.swing.JLabel jLabel23;
    private javax.swing.JLabel jLabel24;
    private javax.swing.JLabel jLabel25;
    private javax.swing.JLabel jLabel26;
    private javax.swing.JLabel jLabel27;
    private javax.swing.JLabel jLabel28;
    private javax.swing.JLabel jLabel29;
    private javax.swing.JLabel jLabel3;
    private javax.swing.JLabel jLabel30;
    private javax.swing.JLabel jLabel31;
    private javax.swing.JLabel jLabel32;
    private javax.swing.JLabel jLabel33;
    private javax.swing.JLabel jLabel34;
    private javax.swing.JLabel jLabel4;
    private javax.swing.JLabel jLabel5;
    private javax.swing.JLabel jLabel6;
    private javax.swing.JLabel jLabel7;
    private javax.swing.JLabel jLabel8;
    private javax.swing.JLabel jLabel9;
    private javax.swing.JLabel jLabelCargo;
    private javax.swing.JScrollPane jScrollPane1;
    private javax.swing.JScrollPane jScrollPane2;
    private javax.swing.JScrollPane jScrollPane3;
    private javax.swing.JTabbedPane jTabbedPane1;
    // End of variables declaration//GEN-END:variables
}
